// 提取课程中的backends
import { GetDocumentQuery } from '@/generated/graphql'
import { useCourseSessionStore } from '@/stores/useCourseStore'
import { assign } from 'lodash-es'

/**
 * 获取extends
 */
export const getExtends = (document: GetDocumentQuery['document']) => {
  const course = useCourseSessionStore()
  const documentExtends: any = {}
  assign(documentExtends, document?.course?.extends, document?.extends)
  return {
    backends: documentExtends[course.type].backends,
    environment: documentExtends[course.type].environment
  }
}
